Assignemnt #47 and Forty-fourth Program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: forty-third Program
///File name: Fourt3Prog.java
///Date Finished:10/20/2015
import java.util.Scanner;
public class Fort4Prog
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String answer, answer_2;
System.out.println( "TWO MORE QUESTIONS!" );
System.out.println( "Think of something and i'll guess it!" );
System.out.println( "Question 1: Does it stay inside or outside or both? " );
System.out.print( "> " );
answer = keyboard.next();
if(answer.equals("inside"))
{
System.out.println( "Question 2: Is it a living thing?" );
System.out.print( "> " );
answer_2 = keyboard.next();
if(answer_2.equals("yes"))
{
System.out.println( "What else could you be thinking of besides a pet bird?" );
}
else if (answer_2.equals("no"))
{
System.out.println( "What else could you be thinking of besides a clock?" );
}
}
else if (answer.equals("outside"))
{
System.out.println( "Question 2: Is it a living thing?" );
System.out.print( "> " );
answer_2 = keyboard.next();
if(answer_2.equals("yes"))
{
System.out.println( "What else could you be thinking of besides a pet fox?" );
}
else if (answer_2.equals("no"))
{
System.out.println( "What else could you be thinking of besides a tractor?" );
}
}
else if (answer.equals("both"))
{
System.out.println( "Question 2: Is it a living thing?" );
System.out.print( "> " );
answer_2 = keyboard.next();
if(answer_2.equals("yes"))
{
System.out.println( "What else could you be thinking of besides a pet cat?" );
}
else if (answer_2.equals("no"))
{
System.out.println( "What else could you be thinking of besides a table?" );
}
}
}
}
Picture of the output